@echo off
@REM Make main package

@ECHO Copying neutral resources to the en-US resource file
if EXIST ECTSSolution.en-US.resx del ECTSSolution.en-US.resx
copy ECTSSolution.resx ECTSSolution.en-US.resx

@ECHO Deleting current WSP file (if it exists)

if EXIST ..\Package\ECTSSolution.wsp del ..\Package\ECTSSolution.wsp

@ECHO Building WSP file...

makecab.exe /f Solution.ddf

@REM Copy over ECTSBase package components
@ECHO Deleting old package components
if EXIST ..\Package\UndeploySolution.cmd del ..\Package\UndeploySolution.cmd
if EXIST ..\Package\ECTSBaseManifest.xml del ..\Package\ECTSBaseManifest.xml
if EXIST ..\Package\ECTSBaseSolution.ddf del ..\Package\ECTSBaseSolution.ddf
if EXIST ..\Package\EAT.Common.dll del ..\Package\EAT.Common.dll
if EXIST ..\Package\ECTSFeatureTemplate.xml del ..\Package\ECTSFeatureTemplate.xml
if EXIST ..\Package\ECTSBase.wsp del ..\Package\ECTSBase.wsp
if EXIST ..\Package\ECTSBase.resx del ..\Package\ECTSBase.resx
if EXIST ..\Package\ECTSBase.en-US.resx del ..\Package\ECTSBase.en-US.resx
if EXIST ..\Package\setup.rpt del ..\Package\setup.rpt
if EXIST ..\Package\setup.inf del ..\Package\setup.inf

@ECHO Copy new package components to the package directory
copy ..\PackageSolution\UndeploySolution.cmd ..\Package\UndeploySolution.cmd
copy ECTSBaseManifest.xml ..\Package\ECTSBaseManifest.xml
copy ECTSBaseSolution.ddf ..\Package\ECTSBaseSolution.ddf
copy ECTSBase.resx ..\Package\ECTSBase.resx
copy ECTSBase.resx ..\Package\ECTSBase.en-US.resx
copy ..\binaries\EAT.Common.dll ..\Package\EAT.Common.dll
copy ..\Common\Common\FEATURES\Common\Feature.xml ..\Package\ECTSFeatureTemplate.xml

@ECHO Invoking WiX
if NOT EXIST "%ProgramFiles%\Windows Installer XML\bin\light.exe" goto :NOWIX

"%ProgramFiles%\Windows Installer XML\bin\candle.exe" -out ..\Package\ECTS.wixobj ECTS.wxs
"%ProgramFiles%\Windows Installer XML\bin\light.exe" -out ..\Package\ECTS.msi ..\Package\ECTS.wixobj

@REM Clean up intermediate file
if EXIST ..\Package\ECTS.wixobj del ..\Package\ECTS.wixobj

goto :END

:NOWIX

@ECHO WIX not installed!  Will not make the MSI.
@ECHO.
@ECHO To build the MSI, please install WiX 2.0 under "%ProgramFiles%\Windows Installer XML".
@ECHO.

:END
